<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}

    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/tidy.css"/>


    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/bootstrap-table/bootstrap-table.css"/>
    <script src="__STATIC_URL__/static/bootstrap-table/bootstrap-table.js"></script>
    <script src="__STATIC_URL__/static/bootstrap-table/bootstrap-table-zh-CN.js"></script>

</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <!--路径导航-->
        <div class="page-heading">
            <ul class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li><a href="#">礼品卡管理</a></li>
                <li style="color: #02b87f;">发货列表</li>
            </ul>
        </div>
        <div class="panel panel-search panel-default mgl15 mgr15">
            <div class="panel-heading">
                <h3 class="panel-title">
                    筛选
                </h3>
            </div>
            <div class="panel-body">
                <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">收货人：</label>
                            <div class="col-sm-9">
                                <input type="text"  autocomplete="off"  class="form-control"  placeholder="请输入昵称" value="" name="name" id="name">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">手机号：</label>
                            <div class="col-sm-9">
                                <input type="text"  autocomplete="off"  class="form-control"  placeholder="请输入手机号" value="" name="phone" id="phone">
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-6 col-md-6 col-lg-4">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">领取时间筛选：</label>
                            <div class="col-sm-9">
                                <div class="input-group">
                                    <input name="search_date" type="text" value=""
                                           readonly="readonly" id="search_date" class="form-control"
                                           placeholder="请选择时间" style="width: 297px">
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">
                <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
            </div>
        </div>
        <!--内容列表-->
        <div class="panel mgl15 mgr15" >
            <div class="panel-heading addCharts" style="background:#ededed;">礼品卡发货列表</div>
            <table class="table table-hover" data-toolbar="#toolbar" id="tablelist">

            </table>
        </div>


        {include file='public/footer'/}
    </div>
</section>
</body>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">发货</h4>
            </div>
            <div class="modal-body" >
                <div class="form-horizontal" data-layout="horizontal">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">收货人：</label>
                        <div class="col-sm-8">
                            <input type="text"  name="name" disabled id="names" class="form-control" maxlength="12" required placeholder="请输入收货人" value="" />
                        </div>
                    </div>
                </div>
                <div class="form-horizontal" data-layout="horizontal">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">手机号：</label>
                        <div class="col-sm-8">
                            <input type="text"  name="phone" id="phones" disabled class="form-control" maxlength="12" required placeholder="请输入手机号" value="" />
                        </div>
                    </div>
                </div>
                <div class="form-horizontal" data-layout="horizontal">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">运单号：</label>
                        <div class="col-sm-8">
                            <input type="text"  name="logistics_no" id="logistics_no" class="form-control" maxlength="30" required placeholder="请输入运单号" value="" />
                        </div>
                    </div>
                </div>


            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-success" id="btns" data-id=""> 发  货 </button>
            </div>
        </div>
    </div>
</div>


<script src="__STATIC_URL__/static/laydate/laydate.js"></script>
<script src="__STATIC_URL__/static/js/times.js"></script>

<script src="/ydhtable.js"></script>

<script>

    $(function () {
        var type = "putorderlist";
        var url = "{:url()}";
        getcolumn(type, url,"tablelist")
    });
    function searchform() {
        $("#tablelist" ).bootstrapTable('refresh');
    }
</script>
<script>
    $('#myModal').on('hide.bs.modal', function () {
        $("#names").val('');
        $("#phones").val('');
        $("#logistics_no").val('');
        $("#btns").attr("data-id","");
    })
    function nums(obj){
        var name=$(obj).attr("data-name");
        $("#names").val(name);
        var phone=$(obj).attr("data-phone");
        $("#phones").val(phone);
        var id=$(obj).attr("data-id");
        $("#btns").attr("data-id",id);
        console.log($("#nums"))
        $("#btns").attr("style","display:bolck");

        $('#myModal').modal('show')
    }
    function numsr(obj){
        var name=$(obj).attr("data-name");
        $("#names").val(name);
        var phone=$(obj).attr("data-phone");
        $("#phones").val(phone);
        var oid=$(obj).attr("data-oid");
        $("#logistics_no").val(oid);

        console.log($("#nums"))
        $('#myModal').modal('show')
        $("#btns").attr("style","display:none");

    }
    $("#btns").click(function(){
        var logistics_no=$("#logistics_no").val();
        var id=$("#btns").attr("data-id");
        if(logistics_no==""){
            layer.msg('请输入运单号！');
            return false;
        }
        // 校验通过，全部都不相同
        $.ajax({
            url: "{:url('cardgifts/putgiftgoods')}",
            type: "post",
            data: {
                logistics_no:logistics_no,
                id:id
            },
            success: function (data) {
                console.log(363,data);
                if(data.code==0){
                    layer.msg(data.message);

                    $('#myModal').modal('hide')
                    $("#logistics_no").val("");
                    window.location.reload()
                }else{
                    layer.msg(data.message);
                }

            }
        })
    })
</script>
<script>

</script>

<script type="text/javascript">

</script>


</html>
